function render(template, data) {
    const reg= /\{\{(\w+)\}\}/;
    if(reg.test(template)){
        const name = reg.exec(template)[1]
        template = template.replace(reg, data[name])
        return render(template, data)
    }
    return template
}


const str = 'my name is {{name}}, and my age is {{age}}'

const data = {
    name: 'bob',
    age: 10
}

console.log(render(str, data));
